package com.qdu.service.impl;

import com.qdu.entity.Userinfo;
import com.qdu.mapper.UserinfoMapper;
import com.qdu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.UUID;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserinfoMapper userinfoMapper;

    @Override
    public void deleteByPrimaryKey(String uid) {
        userinfoMapper.deleteByPrimaryKey(uid);
    }

    @Override
    public void insert(Userinfo record) {
        record.setUid(UUID.randomUUID().toString());
        userinfoMapper.insert(record);
    }

    @Override
    public void insertSelective(Userinfo record) {
        userinfoMapper.insertSelective(record);
    }

    @Override
    public Userinfo selectByPrimaryKey(String uid) {
        return userinfoMapper.selectByPrimaryKey(uid);
    }

    @Override
    public Userinfo selectByUname(String uname) {
        return userinfoMapper.selectByuname(uname);
    }

    @Override
    public Userinfo selectByUphone(String uphone) {
        return userinfoMapper.selectByUphone(uphone);
    }

    @Override
    public Userinfo selectByUemail(String uemail) {
        return userinfoMapper.selectByUmail(uemail);
    }

    @Override
    public void updateByPrimaryKeySelective(Userinfo record) {
        userinfoMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public void updateByPrimaryKey(Userinfo record) {
        userinfoMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<Userinfo> getAll() {
        return userinfoMapper.getAll();
    }

    @Override
    public List<Userinfo> getUserByPage(Integer start, Integer rows) {
        return userinfoMapper.getUserByPage(start,rows);
    }

    @Override
    public Long findTotals() {
        return userinfoMapper.findTotals();
    }
}
